<!-- 个人中心组件 -->
<template>
  <div class="person">
    <div class="person-content" v-if="isLogin">
      <header class="user-header-box">
        <div class="user-header">
          <div class="header-img">
            <img src="@/assets/image/portrait.jpg" alt="" />
          </div>
          <div class="header-admin">
            <div class="header-admin-box">
              <h4>nick43493795</h4>
              <div class="user_qrcode">
                <i class="iconfont icon-erweima"></i>
                <span>会员码</span>
              </div>
            </div>
            <div class="growth">
              <div class="top">
                <p>王者</p>
                <p>
                  成长值801/1001
                  <i class="iconfont icon-fanhui2"></i>
                </p>
              </div>
              <div class="progress">
                <span></span>
              </div>
            </div>
          </div>
          <div class="header-icon">
            <i class="iconfont icon-xiaoxi"></i>
            <i class="iconfont icon-shezhi"> </i>
          </div>
        </div>
        <div class="itemize">
          <a href="javascript:;" class="itemize_collection">
            <div class="num">0</div>
            <div class="">我的收藏</div>
          </a>
          <a href="javascript:;" class="itemize_collection">
            <div class="num">0</div>
            <div class="">我的足迹</div>
          </a>
          <a href="javascript:;" class="itemize_collection">
            <div class="num">0</div>
            <div class="">店铺关注</div>
          </a>
        </div>
        <div class="exclusive">
          <div class="left">
            <i class="icon_vip">
              <img src="@/assets/image/icon-vip.png" />
            </i>
            <span>高级VIP</span>
          </div>
          <div class="center">购物省钱 分享赚钱</div>
          <div class="right">
            <a href="javascript:;">
              <span>立即开通</span>
              <i class="iconfont icon-fanhui2"></i>
            </a>
          </div>
        </div>
      </header>
      <section class="user-list1 user-frist1">
        <div class="user-items-value">
          <div class="item">
            <p>0</p>
            <span>我的团队</span>
          </div>
          <div class="item">
            <p>0</p>
            <span>注册奖励</span>
          </div>
          <div class="item">
            <p>0</p>
            <span>销售奖励</span>
          </div>
        </div>
        <a href="javascript:;" class="broadcasting">
          <div class="icon">
            <i class="iconfont icon-tuiguang"></i>
          </div>
          <div class="textit">我的推广</div>
        </a>
      </section>
      <section class="user-list">
        <div class="user-title">
          <div class="dis-box">
            <h3>我的订单</h3>
            <div class="user-more">
              <a href="javascript:;">
                全部订单
                <i class="iconfont icon-fanhui2"></i>
              </a>
            </div>
          </div>
        </div>
        <ul class="user-item-list">
          <li>
            <a href="javascript:;">
              <h4>
                <i class="user-icon">
                  <img src="@/assets/image/order-1.png" />
                </i>
              </h4>
              <p>待付款</p>
            </a>
          </li>
          <li>
            <a href="javascript:;">
              <h4>
                <i class="user-icon">
                  <img src="@/assets/image/order-2.png" />
                </i>
              </h4>
              <p>待拼团</p>
            </a>
          </li>
          <li>
            <a href="javascript:;">
              <h4>
                <i class="user-icon">
                  <img src="@/assets/image/order-3.png" />
                </i>
              </h4>
              <p>待收货</p>
            </a>
          </li>
          <li>
            <a href="javascript:;">
              <h4>
                <i class="user-icon">
                  <img src="@/assets/image/order-4.png" />
                </i>
              </h4>
              <p>待评价</p>
            </a>
          </li>
          <li>
            <a href="javascript:;">
              <h4>
                <i class="user-icon">
                  <img src="@/assets/image/order-5.png" />
                </i>
              </h4>
              <p>待退货</p>
            </a>
          </li>
        </ul>
      </section>
      <section class="user-list1">
        <div class="user-items-value">
          <a href="javascript:;" class="item items">
            <p>0.00</p>
            <span>余额</span>
          </a>
          <a href="javascript:;" class="item items">
            <p>0</p>
            <span>红包</span>
          </a>
          <a href="javascript:;" class="item items">
            <p>20</p>
            <span>积分</span>
          </a>
        </div>
        <a href="javascript:;" class="broadcasting">
          <div class="icon red">
            <i class="iconfont icon-qianbao2"></i>
          </div>
          <div class="textit">资金管理</div>
        </a>
      </section>
      <section class="user-list" v-for="tool in touchnavarr" :key="tool.top_id">
        <div class="user-title">
          <div class="dis-box">
            <h3 v-text="tool.name"></h3>
          </div>
        </div>
        <div class="user-nav-item">
          <a
            href="javascript:;"
            class="user-item"
            v-for="toolcon in tool.child_nav"
            :key="toolcon.id"
          >
            <label>
              <i class="user-icon">
                <img :src="toolcon.pic" />
              </i>
            </label>
            <p v-text="toolcon.name"></p>
          </a>
        </div>
      </section>
      <h5 class="title-hrbg">
        <span>猜你喜欢</span>
        <hr />
      </h5>
    </div>
    <Login v-else />
  </div>
</template>

<script>
//这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）
//例如：import 《组件名称》 from '《组件路径》';
import Login from "../Login/Login";
import Ajax from "@/api/Ajax";
export default {
  //import引入的组件需要注入到对象中才能使用
  components: { Login },
  data() {
    //这里存放数据
    return {
      touchnavarr: [],
    };
  },
  //监听属性 类似于data概念
  computed: {
    isLogin() {
      return this.$store.state.isLogin;
    },
  },
  //监控data中的数据变化
  watch: {},
  //方法集合
  methods: {
    async touchnav() {
      let result = await Ajax(
        "/api/user/touch_nav",
        {
          device: "h5",
        },
        "post"
      );
      this.touchnavarr = result.data;
    //   console.log(this.touchnavarr);
    },
  },
  mounted() {
    this.touchnav();
  },
};
</script>
<style lang="less">
.person-content {
  margin-bottom: 5rem;
  .user-header-box {
    position: relative;
    height: 19rem;
    background: linear-gradient(-88deg, #ff4c30, #ea0a21);
    .user-header {
      padding: 4rem 1.7rem 1.7rem;
      color: #fff;
      display: flex;
      align-items: center;
      position: relative;
      .header-img {
        width: 7.5rem;
        border: 0.28rem solid hsla(0, 0%, 100%, 0.29);
        border-radius: 50%;
        box-sizing: content-box;
        img {
          border-radius: 50%;
          height: 100%;
          width: 100%;
          display: block;
        }
      }
      .header-admin {
        margin-left: 1.2rem;
        z-index: 2;
        display: block !important;
        width: 100%;
        .header-admin-box {
          position: relative;
          h4 {
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            font-size: 1.4rem;
            font-weight: 600;
            height: 2rem;
          }
          .user_qrcode {
            position: absolute;
            background: rgba(0, 0, 0, 0.1);
            padding: 0.25rem 0.8rem;
            display: flex;
            flex-direction: row;
            justify-content: center;
            align-items: center;
            border-radius: 2rem 0 0 2rem;
            right: -1.7rem;
            top: 0;
            .iconfont {
              height: 14px;
            }
          }
        }
        .growth {
          display: flex;
          flex-direction: column;
          position: relative;
          .top {
            display: flex;
            flex-direction: row;
            justify-content: flex-start;
            align-items: center;
            color: #fff;
            width: 80%;
            p {
              padding: 0 0.8rem;
              background: rgba(0, 0, 0, 0.1);
              display: inline-block;
              border-radius: 1rem;
              line-height: 1.8;
              margin: 0.5rem 0.8rem 0 0;
              .icon-fanhui2 {
                font-size: 1rem;
              }
              &:last-child {
                margin-right: 0;
              }
            }
          }
          .progress {
            height: 2px;
            position: relative;
            border-radius: 4px;
            margin-top: 0.8rem;
            width: 100%;
            overflow: hidden;
            background: hsla(0, 0%, 100%, 0.5);
            span {
              width: 80%;
              background: rgb(255, 255, 255);
              left: 0;
              height: 100%;
              position: absolute;
              border-radius: inherit;
            }
          }
        }
      }
      .header-icon {
        position: absolute;
        top: 1rem;
        display: flex;
        right: 0;
        i {
          color: #fff;
          margin-right: 0.5rem;
        }
        .icon-xiaoxi {
          font-size: 1.8rem;
        }
        .icon-shezhi {
          font-size: 2.1rem;
        }
      }
    }
    .itemize {
      display: flex;
      align-items: center;
      justify-content: space-around;
      .itemize_collection {
        position: relative;
        width: 33.33333%;
        .num {
          font-size: 1.5rem;
          text-align: center;
          font-weight: 600;
          color: #f7f7f7;
        }
        div {
          text-align: center;
          color: #f7f7f7;
        }
        &:nth-child(2) {
          &::before {
            right: 0;
            position: absolute;
            top: 0.3rem;
            box-sizing: border-box;
            bottom: 0.3rem;
            content: "";
            width: 0;
            border-left: 1px solid hsla(0, 0%, 100%, 0.5);
          }
          &::after {
            position: absolute;
            top: 0.3rem;
            left: 0;
            box-sizing: border-box;
            bottom: 0.3rem;
            content: "";
            width: 0;
            border-left: 1px solid hsla(0, 0%, 100%, 0.5);
          }
        }
      }
    }
    .exclusive {
      display: flex;
      align-items: center;
      position: absolute;
      left: 1rem;
      right: 1rem;
      bottom: -2rem;
      z-index: 2;
      background: #fff;
      box-shadow: 0 5px 10px 0 hsla(0, 0%, 42.4%, 0.1);
      justify-content: space-between;
      padding: 1rem 2rem;
      border-radius: 1rem;
      .left {
        display: flex;
        align-items: center;
        .icon_vip {
          width: 1.9rem;
          height: 1.9rem;
          img {
            width: 100%;
            height: auto;
            display: block;
          }
        }
        span {
          font-size: 1.2rem;
          margin-left: 0.5rem;
          font-weight: 500;
        }
      }
      .center {
        padding-left: 1rem;
        color: #805223;
        font-weight: 400;
        flex: 1;
        position: relative;
      }
      .right {
        padding: 0.5rem 1rem 0.5rem 1.2rem;
        background: linear-gradient(0deg, #151515, #2a2724);
        border-radius: 1.5rem;
        display: flex;
        justify-content: center;
        align-items: center;
        span {
          color: #e3c49e;
          font-weight: 500;
        }
        .icon-fanhui2 {
          color: #e3c49e;
          margin-left: 0.3rem;
          font-size: 0.8rem;
          font-weight: 500;
        }
      }
    }
  }
  .user-list1 {
    background-color: #fff;
    display: flex;
    margin: 1rem 1rem 0;
    border-radius: 0.5rem;
    .user-items-value {
      position: relative;
      display: flex;
      width: 79%;
      align-items: center;
      &::after {
        content: "";
        position: absolute;
        z-index: 1;
        top: 0;
        right: -10px;
        width: 15px;
        height: 100%;
        background: url(../../assets/image/after.png);
        background-size: 100% 100%;
      }
      .item {
        display: flex;
        align-items: center;
        flex: 1;
        width: 25%;
        padding: 2rem 0;
        flex-direction: column;
        justify-content: center;
        color: #af743a;
        p {
          width: 6.5rem;
          text-align: center;
          font-size: 1.5rem;
        }
        span {
          margin-top: 0.5rem;
        }
      }
      .items {
        p {
          color: #000;
        }
        span {
          color: #000;
        }
      }
    }
    .broadcasting {
      width: 21%;
      position: relative;
      padding: 1.75rem 0;
      margin-left: 0.1rem;
      .icon {
        text-align: center;
        color: #af743a;
        height: 2.75rem;
        line-height: 2.75rem;
        margin-bottom: 0.25rem;
        .icon-tuiguang {
          font-size: 1.8rem;
        }
      }
      .red {
        background-image: linear-gradient(-30deg, #ef0022, #fb5720);
        background-clip: text;
        color: transparent;
        .icon-qianbao2 {
          font-size: 2.2rem;
        }
      }
      .textit {
        margin-top: 0.5rem;
        text-align: center;
        color: #000;
      }
    }
  }
  .user-frist1 {
    margin-top: 3rem;
  }
  .user-list {
    background-color: #fff;
    margin: 1rem 1rem 0;
    border-radius: 0.5rem;
    .user-title {
      position: relative;
      &::after {
        content: "";
        position: absolute;
        bottom: 0;
        height: 1px;
        left: 1.1rem;
        right: 1.1rem;
        background: #ebebeb;
      }
      .dis-box {
        padding: 1.1rem;
        display: flex;
        align-items: center;
        justify-content: space-between;
        h3 {
          font-weight: 550;
          color: #000;
          padding-top: 0.4rem;
          display: block !important;
        }
        .user-more {
          position: relative;
          padding-right: 0;
          display: block;
          a {
            color: #888;
            .icon-fanhui2 {
              font-size: 1.2rem;
            }
          }
        }
      }
    }
    .user-item-list {
      display: flex;
      align-items: center;
      text-align: center;
      padding: 1.8rem 0;
      li {
        padding: 0 1.1rem;
        position: relative;
        display: block !important;
        width: 100%;
        h4 {
          font-size: 1.8rem;
          color: #ac8054;
          .user-icon {
            width: 2.5rem;
            height: 2.5rem;
            display: inline-block;
            img {
              width: 100%;
              height: auto;
              display: block;
            }
          }
        }
        p {
          font-size: 1.2rem;
          color: #333;
          margin-top: 0.5rem;
        }
      }
    }
    .user-nav-item {
      width: 100%;
      box-sizing: border-box;
      display: flex;
      flex-wrap: wrap;
      .user-item {
        width: 25%;
        padding: 1.6rem 0 1rem;
        color: #232326;
        text-align: center;
        label {
          .user-icon {
            font-size: 2.6rem;
            width: 2.7rem;
            height: 2.7rem;
            display: inline-block;
            img {
              width: 100%;
              height: auto;
              display: block;
            }
          }
        }
        p {
          color: #333;
          margin-top: 0.8rem;
        }
      }
    }
  }
  .title-hrbg {
    font-size: 1.3rem;
    position: relative;
    z-index: 1;
    height: 4rem;
    line-height: 4rem;
    overflow: hidden;
    color: #888;
    text-align: center;
    span {
      background: #f3f3f3;
      padding: 1rem 0.6rem;
      font-size: 1.4rem;
      font-weight: 500;
      z-index: 10;
    }
    hr {
      background: #ddd;
      height: 1px;
      border: 0;
      position: absolute;
      left: 100px;
      right: 100px;
      top: 50%;
      margin-top: 1px;
      z-index: -1;
    }
  }
}
</style>